String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
//验证提交
function checkSubmit()
{
   var name=$("#departId");
   if($("#departId").val().trim().length==0)
   {
      alert('请选择科室');
      name.focus();
      return ;
   }
   var name=$("#name");
   if($("#name").val().trim().length==0)
   {
      alert('请填写姓名');
      name.focus();
      return ;
   }
   var idcard=$("#idcard");
   if($("#idcard").val().trim().length==0)
   {
      alert('请填写身份证');
      idcard.focus();
      return ;
   }
   if($("#fileInput").val()!='' && $("#fileInput").val()!=undefined){
	  		$("#if_has_File").val('1');
	  	}
   if($("#fileInput1").val()!='' && $("#fileInput1").val()!=undefined){
	  		$("#if_has_File").val('1');
	  	}
   if(!validTextareaLength()){
			return ;
		}
   $("#myForm").submit();
}
$(document).ready(function()
{
     var dep = $("#dep");
     $.ajax({
        url:'../../tiCase/loadDepartMentJson.action',
        type:'post',
        success:function(msg){
            var obj =eval('('+msg+')');
            var  thtml="";
            $.each(obj,function(i,n){
                
                 var b=n["id"];
                 var c=n["name"];
                thtml+= '<option value='+b+'>'+c+'</option>';
                
            });
             dep.html(thtml); 
            
        }
     });
}
);


